'use strict'

class feedback {
  constructor() {
    this.param = '/'
  }

  async post(c) {
    console.log(c.body)
    const feedback_type_id = c.body.type
    const feedback_img = c.body.content.image
    const feedback_number = c.body.number
    const user_id = c.box.user.openid
    const text = c.body.content.text
    const feedback = text.slice(0, text.length-2)
    let ret = await c.service.psql.query(`insert into feedback(user_id,feedback_type_id,feedback,feedback_img,feedback_number) values('${user_id}','${feedback_type_id}','${feedback}','${feedback_img}','${feedback_number}')`)
    console.log(ret)
    c.status(200).send('已接收')
  }

}

module.exports = feedback
